package org.come.starcard;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;

import org.come.Frame.TestpackJframe;
import org.come.Frame.ZhuFrame;
import org.come.bean.SuitOperBean;
import org.come.entity.Goodstable;
import org.come.socket.Agreement;
import org.come.socket.SendMessageUntil;
import org.come.until.CutButtonImage;
import org.come.until.GoodsListFromServerUntil;
import org.come.until.GsonUtil;
import org.come.until.Util;

import com.tool.btn.FormsOnOffBtn;
import com.tool.role.RoleData;
import com.tool.tcpimg.RichLabel;
import com.tool.tcpimg.UIUtils;
import com.updateNew.MyIsif;



/**
 * 星卡主面板
 * <p>
 * Title : JpanelStarCardMain
 * </p>
 *
 * @author : HGC
 * @version : 1.0.0
 * @date : 2019年8月6日 上午10:38:11
 */
public class JpanelStarCardMain extends JPanel {

    /**
     * cardBackImg星卡图片边框<br>
     * cardImg星卡图片(属性)<br>
     * starCardImg星卡图片(重铸)<br>
     * materialsImgs消耗材料图片<br>
     * radioOneImg单选第一个<br>
     * radioTwoImg单选第二个<br>
     * consumeOneLab消耗栏第一个<br>
     * consumeTwoLab消耗栏第二个<br>
     * starArryBackImg星阵边框<br>
     * starArryImg星阵图片<br>
     */
    private JLabel cardBackImg, cardImg, starCardImg, materialsImgs, radioOneImg, radioTwoImg, consumeOneLab,
            consumeTwoLab, starArrayBackImg, starArryImg;

    /**
     * lockBtn锁图标11<br>
     * unlockBtn解锁图标12<br>
     * attributeMenuBtn属性菜单按钮1<br>
     * recastMenuBtn重铸菜单按钮2<br>
     * cultivateBtn培养子菜单按钮3<br>
     * upgradeBtn升级子菜单按钮4<br>
     * redoBtn重洗子菜单按钮5<br>
     * lianStarBtn练星子菜单按钮6<br>
     * caozuoBtn操作按钮20<br>
     * joinBtn参战按钮21<br>
     * fetchBtn取出按钮22<br>
     * soulBackBtn魂归按钮23<br>
     * exchangeBtn魂归按钮24<br>
     * supplementBtn补充按钮25<br>
     * deleteBtn删除按钮26<br>
     * transferBtn转移按钮27<br>
     */
    private BtnStarCard lockBtn, unlockBtn, attributeMenuBtn, recastMenuBtn, cultivateBtn, lianStarBtn, upgradeBtn,
            redoBtn, caozuoBtn, joinBtn, fetchBtn, soulBackBtn, exchangeBtn, supplementBtn, deleteBtn, transferBtn;

    /**
     * materialsLab拥有材料12个格子<br>
     * starCardLab拥有材料24个格子<br>
     */
    private JLabel[] materialsLab, starCardLab;

    private RichLabel nameLvlLab, powerLab, fiveElementsLab, StarArrayLab;

    /**
     * 大菜单项标识 <br>
     * 1属性菜单按钮标识<br>
     * 2重铸菜单按钮标识<br>
     */
    private int bigType = -1;
    /**
     * 小菜单项标识<br>
     * 1培养子菜单按钮标识<br>
     * 2升级子菜单按钮标识<br>
     * 3重洗子菜单按钮标识<br>
     * 4练星子菜单按钮标识<br>
     */
    private int smallType = -1;
    /**
     * 单选标识<br>
     * 1重洗子菜单中的重洗神通标识<br>
     * 2重洗子菜单中的重洗五行标识<br>
     */
    private int radioType = -1;

    /**
     * 当前选中的星卡Id
     */
    private BigDecimal chooseStarCardId;
    /**
     * 当前选中的材料Id
     */
    private BigDecimal chooseMaterialsId;

    /**
     * 消耗金钱
     */
    private BigDecimal money;

    private long materialType = 0;

    public JpanelStarCardMain() {
        if ("水墨UI".equals(MyIsif.getStyle())) {
            setPreferredSize(new Dimension(637, 425));
            setOpaque(false);
            setLayout(null);
            // 关闭按钮事件
            FormsOnOffBtn offBtn = new FormsOnOffBtn("inkImg/old/2/1.png", 1, 95);
            offBtn.setBounds(637 - 37, 10, 25, 25);
            this.add(offBtn);
        } else {
            setPreferredSize(new Dimension(611, 447));
            setOpaque(false);
            setLayout(null);
            // 关闭按钮事件
            FormsOnOffBtn offBtn = new FormsOnOffBtn("inkImg/hongmu/1/s74.png", 1, 95);
            offBtn.setBounds(586, 0, 25, 25);
            this.add(offBtn);
        }


        /** 添加组件 */
        getCardBackImg();
        getCardImg();
        getLockBtn();
        getUnlockBtn();
        getAttributeMenuBtn();
        getRecastMenuBtn();
        getCultivateBtn();
        getLianStarBtn();
        getUpgradeBtn();
        getRedoBtn();

        getStarCardImg();
        getMaterialsImgs();
        getRadioTwoImg();
        getRadioOneImg();
        getSupplementBtn();
        getConsumeTwoLab();
        getConsumeOneLab();
        getMaterialsLab();
        getStarCardLab();
        getCaozuoBtn();
        getJoinBtn();
        getFetchBtn();
        getSoulBackBtn();
        getExchangeBtn();

        getNameLvlLab();
        getPowerLab();
        getFiveElementsLab();
        getStarArrayLab();
        getStarArryImg();
        getStarArrayBackImg();
        getDeleteBtn();
        getTransferBtn();

        changeBigMenuLeftView(1);
    }

    /**
     * 大菜单项切换面板
     *
     * @param type
     */
    public void changeBigMenuLeftView(int type) {
        if (type == -1) {
            if (bigType == -1) {
                type = 1;
            } else {
                return;
            }
        }
        bigType = type;
        clearAttributeShow();
        if ("水墨UI".equals(MyIsif.getStyle())) {
            if (bigType == 1) {
                viewRecastMenuBtn(false);
                viewAttributeMenuBtn(true);
                iconLeft = CutButtonImage.getImage("inkImg/newbackground/B284.png", 159, 114);
            } else if (bigType == 2) {
                viewAttributeMenuBtn(false);
                viewRecastMenuBtn(true);
                iconLeft = CutButtonImage.getImage("inkImg/newbackground/B285.png", 309, 105);
            }
        } else {
            if (bigType == 1) {
                viewRecastMenuBtn(false);
                viewAttributeMenuBtn(true);
                iconLeft = CutButtonImage.getImage("inkImg/hongmu/2/战力显示框-W：162-H：115.png", 162, 114);
            } else if (bigType == 2) {
                viewAttributeMenuBtn(false);
                viewRecastMenuBtn(true);
                iconLeft = CutButtonImage.getImage("inkImg/hongmu/2/下面面板框-W：309-H：105.png", 309, 105);
            }
        }
    }

    /**
     * 小菜单项面板切换
     *
     * @param type
     */
    public void changeSmallMenuLeftView(int type) {
        if (type == -1) {
            if (smallType == -1) {
                type = 1;
            } else {
                viewChange(false);
                return;
            }
        }
        viewChange(false);
        if (bigType == 2) {
            smallType = type;
            viewChange(true);
        }
    }

    /**
     * 切换重洗面板单选框展示面板
     */
    public void changeRadioView(int type) {
        if ("水墨UI".equals(MyIsif.getStyle())) {
            if (type == -1) {
                if (radioType == -1) {
                    type = 1;
                    radioType = type;
                }
                if (chooseMaterialsId != null) {
                    recoverMaterialsImg();
                }
                if (radioType == 1) {
                    materialType = 524;
                    materialsImgs.setText("浑天石");
                } else {
                    materialType = 523;
                    materialsImgs.setText("易象符");
                }
            } else {
                radioType = type;
                if (radioType == 1) {
                    materialType = 524;
                    radioOneImg.setIcon(CutButtonImage.getImage("skin/8100226/button/B118.png", 7, 7));
                    radioTwoImg.setIcon(null);
                    materialsImgs.setText("浑天石");
                } else if (radioType == 2) {
                    materialType = 523;
                    radioOneImg.setIcon(null);
                    radioTwoImg.setIcon(CutButtonImage.getImage("skin/8100226/button/B118.png", 7, 7));
                    materialsImgs.setText("易象符");
                }
                if (chooseMaterialsId != null) {
                    recoverMaterialsImg();
                }
            }
        } else {
            if (type == -1) {
                if (radioType == -1) {
                    type = 1;
                    radioType = type;
                }
                if (chooseMaterialsId != null) {
                    recoverMaterialsImg();
                }
                if (radioType == 1) {
                    materialType = 524;
                    materialsImgs.setText("浑天石");
                } else {
                    materialType = 523;
                    materialsImgs.setText("易象符");
                }

            } else {
                radioType = type;
                if (radioType == 1) {
                    materialType = 524;
                    radioOneImg.setIcon(CutButtonImage.getImage("inkImg/hongmu/2/单选按钮_选中_w19,h19.png", 19, 19));
                    radioTwoImg.setIcon(CutButtonImage.getImage("inkImg/hongmu/2/单选按钮_未选中_w19,h19.png", 19, 19));
                    materialsImgs.setText("浑天石");
                } else if (radioType == 2) {
                    materialType = 523;
                    radioOneImg.setIcon(null);
                    radioOneImg.setIcon(CutButtonImage.getImage("inkImg/hongmu/2/单选按钮_未选中_w19,h19.png", 19, 19));
                    radioTwoImg.setIcon(CutButtonImage.getImage("inkImg/hongmu/2/单选按钮_选中_w19,h19.png", 19, 19));
                    materialsImgs.setText("易象符");
                }
                if (chooseMaterialsId != null) {
                    recoverMaterialsImg();
                }
            }
        }
    }

    /**
     * 清空并恢复第一个展示框
     */
    public void recoverStarCardImg() {
        starCardImg.setIcon(null);
        starCardImg.setText("地煞星");
        chooseStarCardId = null;
    }

    /**
     * 选中星卡展示
     */
    public void chooseStarCardImg(Goodstable goodstable) {
        chooseStarCardId = goodstable.getRgid();
        starCardImg.setText("");
        starCardImg.setIcon(GoodsListFromServerUntil.imgpathAdaptive(goodstable.getSkin(), 55, 53));
    }

    /**
     * 选中材料展示
     */
    public void chooseMaterialsImg(Goodstable goodstable) {
        chooseMaterialsId = goodstable.getRgid();
        materialsImgs.setText("");
        materialsImgs.setIcon(GoodsListFromServerUntil.imgpathAdaptive(goodstable.getSkin(), 55, 53));
    }

    /**
     * 清空选中的材料
     */
    public void recoverMaterialsImg() {
        chooseMaterialsId = null;
        if (smallType == 1) {
            materialsImgs.setText("观星册");
        } else if (smallType == 2) {
            materialsImgs.setText("矿石");
        } else if (smallType == 3) {
            changeRadioView(-1);
        } else if (smallType == 4) {
            materialsImgs.setText("炼星石");
        }
        materialsImgs.setIcon(null);
    }

    /**
     * 根据小菜单项编号隐藏或者展示对应面板
     *
     * @param
     * @param type
     */
    public void viewChange(boolean type) {
        if ("水墨UI".equals(MyIsif.getStyle())) {
            if (smallType == 1) {
                iconRight = CutButtonImage.getImage("inkImg/newbackground/B289.png", 290, 200);
                viewCultivateBtn(type);
            } else if (smallType == 2) {
                iconRight = CutButtonImage.getImage("inkImg/newbackground/B290.png", 290, 200);
                viewUpgradeBtn(type);
            } else if (smallType == 3) {
                iconRight = CutButtonImage.getImage("inkImg/newbackground/B291.png", 290, 200);
                viewRedoBtn(type);
            } else if (smallType == 4) {
                iconRight = CutButtonImage.getImage("inkImg/newbackground/B288.png", 290, 200);
                viewLianStarBtn(type);
            }
        } else {
            if (this.smallType == 1) {
                iconRight = CutButtonImage.getImage("inkImg/hongmu/2/培养面板-W：288-H：198.png", 288, 198);
                this.viewCultivateBtn(type);
            } else if (this.smallType == 2) {
                iconRight = CutButtonImage.getImage("inkImg/hongmu/2/升级面板-W：288-H：198.png", 288, 198);
                this.viewUpgradeBtn(type);
            } else if (this.smallType == 3) {
                iconRight = CutButtonImage.getImage("inkImg/hongmu/2/重洗面板-W：288-H：198.png", 288, 198);
                this.viewRedoBtn(type);
            } else if (this.smallType == 4) {
                iconRight = CutButtonImage.getImage("inkImg/hongmu/2/练星面板-W：288-H：198.png", 288, 198);
                this.viewLianStarBtn(type);
            }
        }
    }

    /**
     * 大菜单项属性面板
     *
     * @param type
     */
    public void viewAttributeMenuBtn(boolean type) {
        cardBackImg.setVisible(type);
        lockBtn.setVisible(type);
        unlockBtn.setVisible(type);
        cardImg.setVisible(type);
        joinBtn.setVisible(type);
        consumeOneLab.setVisible(type);
        consumeTwoLab.setVisible(type);
        supplementBtn.setVisible(type);
        nameLvlLab.setVisible(type);
        powerLab.setVisible(type);
        fiveElementsLab.setVisible(type);
        StarArrayLab.setVisible(type);
        showStarArray(false, null);
        if (type) {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                consumeOneLab.setBounds(73 + 25, 320 - 15, 103, 16);
                consumeTwoLab.setBounds(73 + 25, 320 + 25 - 15, 103, 16);
            } else {
                consumeOneLab.setBounds(73, 320, 103, 16);
                consumeTwoLab.setBounds(73, 345, 103, 16);
            }
            nameLvlLab.setText("");
            powerLab.setText("");
            fiveElementsLab.setText("");
            StarArrayLab.setText("");
        }
    }

    /**
     * 大菜单项重铸面板切换
     *
     * @param type
     */
    public void viewRecastMenuBtn(boolean type) {
        caozuoBtn.setVisible(type);
        starCardImg.setVisible(type);
        materialsImgs.setVisible(type);
        cultivateBtn.setVisible(type);
        redoBtn.setVisible(type);
        upgradeBtn.setVisible(type);
        lianStarBtn.setVisible(type);
        for (int i = 0; i < materialsLab.length; i++) {
            materialsLab[i].setVisible(type);
        }
        changeSmallMenuLeftView(smallType);

    }

    /**
     * 培养按钮面板切换
     *
     * @param type
     */
    public void viewCultivateBtn(boolean type) {
        // starCardImg.setVisible(type);
        // materialsImgs.setVisible(type);
        // consumeOneLab.setVisible(type);
        consumeTwoLab.setVisible(type);
        if (type) {
            materialType = 522;
            money = new BigDecimal(500000);
            if ("水墨UI".equals(MyIsif.getStyle())) {
                starCardImg.setBounds(162 + 25, 83 - 15, 55, 53);
                recoverStarCardImg();
                caozuoBtn.setText("培养");
                // starCardImg.setIcon(null);
                materialsImgs.setBounds(249 + 25, 83 - 15, 55, 53);
                recoverMaterialsImg();
                // consumeOneLab.setBounds(173, 181, 108, 16);
                consumeTwoLab.setBounds(173 + 25, 181 + 21 - 15, 108, 16);
                consumeTwoLab.setText("");
            } else {
            }
            {
                starCardImg.setBounds(163, 86, 55, 53);
                recoverStarCardImg();
                caozuoBtn.setText("培 养");
                materialsImgs.setBounds(249, 86, 55, 53);
                recoverMaterialsImg();
                consumeTwoLab.setBounds(173, 202, 108, 16);
                consumeTwoLab.setText("");
            }
        }
    }

    /**
     * 重洗按钮面板切换
     *
     * @param type
     */
    public void viewRedoBtn(boolean type) {
        radioOneImg.setVisible(type);
        radioTwoImg.setVisible(type);
        if (type) {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                starCardImg.setBounds(131 + 25, 118 - 15, 55, 53);
                recoverStarCardImg();
                caozuoBtn.setText("重洗");
                // starCardImg.setIcon(null);
                money = new BigDecimal(500000);
                materialsImgs.setBounds(218 + 25, 118 - 15, 55, 53);
                recoverMaterialsImg();
            } else {
                starCardImg.setBounds(131, 118, 55, 53);
                recoverStarCardImg();
                caozuoBtn.setText("重洗");
                // starCardImg.setIcon(null);
                money = new BigDecimal(500000);
                materialsImgs.setBounds(218, 118, 55, 53);
                recoverMaterialsImg();
            }
        }
    }

    /**
     * 升级按钮面板切换
     *
     * @param type
     */
    public void viewUpgradeBtn(boolean type) {
        if (type) {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                materialType = 500;
                starCardImg.setBounds(130 + 25, 92 - 15, 55, 53);
                recoverStarCardImg();
                caozuoBtn.setText("升级");
                // starCardImg.setIcon(null);
                materialsImgs.setBounds(217 + 25, 92 - 15, 55, 53);
                recoverMaterialsImg();
                money = new BigDecimal(0);
            } else {
                materialType = 500;
                starCardImg.setBounds(130, 92, 55, 53);
                recoverStarCardImg();
                caozuoBtn.setText("升级");
                // starCardImg.setIcon(null);
                materialsImgs.setBounds(217, 92, 55, 53);
                recoverMaterialsImg();
                money = new BigDecimal(0);
            }
        }
    }

    /**
     * 练星按钮面板切换
     *
     * @param type
     */
    public void viewLianStarBtn(boolean type) {
        consumeOneLab.setVisible(type);
        if (type) {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                materialType = 521;
                starCardImg.setBounds(130 + 25, 125 - 15, 55, 53);
                recoverStarCardImg();
                caozuoBtn.setText("练星");
                // starCardImg.setIcon(null);
                materialsImgs.setBounds(217 + 25, 125 - 15, 55, 53);
                recoverMaterialsImg();
                consumeOneLab.setBounds(220 + 25, 184 - 15, 48, 16);
                consumeOneLab.setText("");
            } else {
                materialType = 521;
                starCardImg.setBounds(130, 125, 55, 53);
                recoverStarCardImg();
                caozuoBtn.setText("练星");
                // starCardImg.setIcon(null);
                materialsImgs.setBounds(217, 125, 55, 53);
                recoverMaterialsImg();
                consumeOneLab.setBounds(220, 184, 48, 16);
                consumeOneLab.setText("");
            }
        }
    }

    /**
     * 面板变动
     */
    public void viewChange(Goodstable goodstable) {
        if (goodstable == null) {
            if (chooseStarCardId == null && smallType == 1) {
                // consumeOneLab.setText("");
                consumeTwoLab.setText("");
            } else if (smallType == 4) {
                consumeOneLab.setText("");
            }
            return;
        }
        if (goodstable.getType() == 520) {
            String[] value = goodstable.getValue().split("\\|");
            String[] level = value[0].split("=")[1].split("/");
            // 当前等级
            int lvlNow = Integer.parseInt(level[0]);
            if (smallType == 1) {

                if (lvlNow >= 14) {
                    consumeTwoLab.setText("");
                } else {
                    int power = Integer.parseInt(value[1].split("=")[1]);
                    consumeTwoLab.setText(power + "/" + lvlNow * 200);
                }
            } else if (smallType == 2) {
                chooseStarCardImg(goodstable);
                money = new BigDecimal(lvlNow * 20000000);
            } else {
                if (chooseMaterialsId == null) {
                    return;
                }
                Goodstable chooseMaterial = GoodsListFromServerUntil.getRgid(chooseMaterialsId);
                if (chooseMaterial == null) {
                    return;
                }
                if (smallType == 4) {
                    int lvlMax2 = Integer.parseInt(level[1]);
                    if (lvlMax2 >= 14) {
                        consumeOneLab.setForeground(Color.white);
                        consumeOneLab.setText("0/0");
                    } else {
                        int num = lvlMax2 / 2 + 2;
                        if (num < chooseMaterial.getUsetime()) {
                            consumeOneLab.setForeground(Color.white);
                            consumeOneLab.setText(num + "/" + chooseMaterial.getUsetime());
                        } else {
                            consumeOneLab.setForeground(Color.red);
                            consumeOneLab.setText(num + "/" + chooseMaterial.getUsetime());
                        }
                    }
                    return;
                }
            }

        } else {
            if (chooseStarCardId == null) {
                return;
            }
            Goodstable chooseStarCard = GoodsListFromServerUntil.getRgid(chooseStarCardId);
            if (chooseStarCard == null) {
                return;
            }
            String[] value = chooseStarCard.getValue().split("\\|");
            String[] level = value[0].split("=")[1].split("/");
            if (smallType == 4) {
                int lvlMax2 = Integer.parseInt(level[1]);
                if (lvlMax2 >= 14) {
                    consumeOneLab.setText("0/0");
                } else {
                    int num = lvlMax2 / 2 + 2;
                    if (num <= goodstable.getUsetime()) {
                        consumeOneLab.setForeground(Color.white);
                        consumeOneLab.setText(num + "/" + goodstable.getUsetime());
                    } else {
                        consumeOneLab.setForeground(Color.red);
                        consumeOneLab.setText(num + "/" + goodstable.getUsetime());
                    }
                }
                return;
            }
        }
    }

    /**
     * 属性面板信息展示
     */
    public void attributeImgShow(Goodstable goodstable) {
        if (goodstable == null) {
            chooseStarCardId = null;
            nameLvlLab.setText("");
            powerLab.setText("");
            fiveElementsLab.setText("");
            StarArrayLab.setText("");
            consumeOneLab.setText("");
            consumeTwoLab.setText("");
            cardImg.setIcon(null);
            showStarArray(false, null);
            joinBtn.setText("参战");
            return;
        }
        chooseStarCardId = goodstable.getRgid();
        if (goodstable.getStatus() == 1) {
            joinBtn.setText("待机");
        } else {
            joinBtn.setText("参战");
        }
        cardImg.setIcon(CutButtonImage.getImage("img/head/" + goodstable.getSkin() + ".png", -1, -1));
        String[] value = goodstable.getValue().split("\\|");
        String[] level = value[0].split("=")[1].split("/");
        int warPower = Integer.parseInt(value[2].split("=")[1]);
        int lvlNow = Integer.parseInt(level[0]);
        int lvlMax = Integer.parseInt(level[1]);
        int power = Integer.parseInt(value[1].split("=")[1]);
        consumeOneLab.setForeground(Color.white);
        consumeOneLab.setText(power + "/" + (lvlNow * 200));
        consumeTwoLab.setText(warPower + "");

        nameLvlLab.setText("#cD3D001  " + goodstable.getGoodsname() + "#r #r#W【等级】 " + lvlNow + " / " + lvlMax);
        String[] strings = value[3].split("&");
        powerLab.setText("#W【神通】 资质：" + strings[1].split("=")[1] + "/100#r#G" + getRefiningAttribute(strings[2], "+")
                + "#r" + getRefiningAttribute(strings[3], "+"));

        String[] fiveElements = value[4].split("&");
        StringBuffer buffer = new StringBuffer();
        buffer.append("#W【五行】");
        for (int i = 1; i < fiveElements.length; i++) {
            buffer.append("#r#Y" + getRefiningAttribute(fiveElements[i], " "));
        }
        boolean is = false;
        double num = 0;
        for (int i = 0; i < strings.length; i++) {
            if (strings[i].startsWith("星阵属性")) {
                // strings[i].split("&")[2];
                String[] satrArry = strings[i].split("=");
                for (int j = 1; j < fiveElements.length; j++) {
                    String[] split = fiveElements[j].split("=");
                    num += fiveElementRestrainCreate(satrArry[2], split[0], split[1]);
                }
                buffer.append("#r#c43E4D2" + "五行加成星阵之力 " + String.format("%.1f", num) + "%");
                StarArrayLab.setText("#W【星阵之力】 " + satrArry[1]);
                showStarArray(true, CutButtonImage.getImage("inkImg/old/skill/" + satrArry[1] + ".png", 47, 47));
                is = true;
            }
        }
        if (!is) {
            buffer.append("#r#Y无星阵，五行暂不生效");
            StarArrayLab.setText("#W【星阵之力】 无");
            showStarArray(false, null);
        }
        fiveElementsLab.setText(buffer.toString());

    }

    /**
     * 星阵属性展示
     */
    public void showStarArray(boolean type, ImageIcon iconPath) {
        starArrayBackImg.setVisible(type);
        starArryImg.setVisible(type);
        starArryImg.setIcon(iconPath);
        deleteBtn.setVisible(type);
        transferBtn.setVisible(type);
    }

    /**
     * 判断相克五行属性
     */
    public static Integer fiveElementRestrainNum(String attr) {
        if ("金".equals(attr)) {
            return 1;
        } else if ("木".equals(attr)) {
            return 2;
        } else if ("土".equals(attr)) {
            return 3;
        } else if ("水".equals(attr)) {
            return 4;
        } else if ("火".equals(attr)) {
            return 5;
        }
        return null;
    }

    /**
     * 判断相生五行属性
     */
    public static Integer fiveElementCreateNum(String attr) {
        if ("金".equals(attr)) {
            return 1;
        } else if ("水".equals(attr)) {
            return 2;
        } else if ("木".equals(attr)) {
            return 3;
        } else if ("火".equals(attr)) {
            return 4;
        } else if ("土".equals(attr)) {
            return 5;
        }
        return null;
    }

    /**
     * 判断相生相克
     */
    public static double fiveElementRestrainCreate(String attr, String value, String num) {
        Integer num1 = fiveElementRestrainNum(attr);
        Integer num2 = fiveElementRestrainNum(value);
        int abs = Math.abs(num1 - num2);
        if (abs == 1 || abs == 4) {// 相克
            if ((num1 == 1 && num2 == 5) || (num1 > num2)) {
                return Integer.parseInt(num) * 0.1;
            }
        }
        num1 = fiveElementCreateNum(attr);
        num2 = fiveElementCreateNum(value);
        abs = Math.abs(num1 - num2);
        if (abs == 1 || abs == 4) {// 相生
            if ((num1 == 1 && num2 == 5) || (num1 > num2)) {
                return Integer.parseInt(num) * 0.3;
            }
        }
        return Integer.parseInt(num) * 0.2;
    }

    /**
     * 切割字符串获取对应炼化属性数据
     */
    public String getRefiningAttribute(String value, String interval) {
        String[] split = value.split("=");
        return split[0] + interval + split[1];
    }

    /**
     * 清空属性展示面板信息
     */
    public void clearAttributeShow() {
        cardImg.setIcon(null);
        chooseStarCardId = null;
        consumeOneLab.setText("");
        consumeTwoLab.setText("");
    }

    /**
     * 星卡操作
     */
    public void caoZuoStarCard() {
        if (chooseStarCardId == null) {
            ZhuFrame.getZhuJpanel().addPrompt2("请选择要培养的星卡");
            return;
        }
        Goodstable goodstable = GoodsListFromServerUntil.getRgid(chooseStarCardId);
        if (goodstable == null) {
            ZhuFrame.getZhuJpanel().addPrompt2("请选择要培养的星卡");
            return;
        }
        if (chooseMaterialsId == null) {
            ZhuFrame.getZhuJpanel().addPrompt2("请选择材料");
            return;
        }
        String[] values = goodstable.getValue().split("\\|");
        String[] level = values[0].split("=")[1].split("/");
        // 当前等级
        int lvlNow = Integer.parseInt(level[0]);
        // 等级上限
        int lvlMax = Integer.parseInt(level[1]);
        // 神力
        int power = Integer.parseInt(values[1].split("=")[1]);

        Goodstable chooseMaterialsGoods = GoodsListFromServerUntil.getRgid(chooseMaterialsId);
        if (chooseMaterialsGoods == null) {
            ZhuFrame.getZhuJpanel().addPrompt2("请放入物品");
            return;
        }
        int num = 1;
        int type = 0;
        if (smallType == 1) {
            if (lvlNow >= 14) {
                ZhuFrame.getZhuJpanel().addPrompt2("等级已经抵达上限");
                return;
            }
            if (chooseMaterialsGoods.getType() != 522) {
                ZhuFrame.getZhuJpanel().addPrompt2("物品不是观星册");
                return;
            }
            if (chooseMaterialsGoods.getUsetime() < num) {
                ZhuFrame.getZhuJpanel().addPrompt2("观星册数量不足");
                return;
            }
            if (power >= lvlNow * 200) {
                ZhuFrame.getZhuJpanel().addPrompt2("神力已经抵达上限，无法培养");
                return;
            }
            if (money.compareTo(RoleData.getRoleData().getLoginResult().getGold()) > 0) {
                // 金额不足
                ZhuFrame.getZhuJpanel().addPrompt2("大话币不足");
                return;
            }
            type = 51;
        } else if (smallType == 2) {
            if (power < lvlNow * 200) {

                ZhuFrame.getZhuJpanel().addPrompt2("神力没有抵达上限，无法升级");
                return;
            }
            if (lvlNow >= lvlMax) {
                ZhuFrame.getZhuJpanel().addPrompt2("等级已经抵达等级上限,无法继续升级");
                return;
            }
            if (chooseMaterialsGoods.getType() != 500) {
                ZhuFrame.getZhuJpanel().addPrompt2("物品不是矿石");
                return;
            }
            int materialsLvl = Integer.parseInt(chooseMaterialsGoods.getValue().split("=")[1]);
            if (materialsLvl != 11) {
                ZhuFrame.getZhuJpanel().addPrompt2("物品不是11级矿石");
                return;
            }
            if (chooseMaterialsGoods.getUsetime() < num) {
                ZhuFrame.getZhuJpanel().addPrompt2("矿石数量不足");
                return;
            }
            if (money.compareTo(RoleData.getRoleData().getLoginResult().getGold()) > 0) {
                // 金额不足
                ZhuFrame.getZhuJpanel().addPrompt2("大话币不足");
                return;
            }
            type = 52;
        } else if (smallType == 3) {
            if (radioType == 1) {
                if (chooseMaterialsGoods.getType() != 524) {
                    ZhuFrame.getZhuJpanel().addPrompt2("物品不是浑天石");
                    return;
                }
                if (chooseMaterialsGoods.getUsetime() < num) {
                    ZhuFrame.getZhuJpanel().addPrompt2("浑天石数量不足");
                    return;
                }
                if (money.compareTo(RoleData.getRoleData().getLoginResult().getGold()) > 0) {
                    // 金额不足
                    ZhuFrame.getZhuJpanel().addPrompt2("大话币不足");
                    return;
                }
                type = 53;

            } else if (radioType == 2) {
                if (chooseMaterialsGoods.getType() != 523) {
                    ZhuFrame.getZhuJpanel().addPrompt2("物品不是易象符");
                    return;
                }
                if (chooseMaterialsGoods.getUsetime() < num) {
                    ZhuFrame.getZhuJpanel().addPrompt2("易象符数量不足");
                    return;
                }
                if (money.compareTo(RoleData.getRoleData().getLoginResult().getGold()) > 0) {
                    // 金额不足
                    ZhuFrame.getZhuJpanel().addPrompt2("大话币不足");
                    return;
                }
                type = 54;
            }

        } else if (smallType == 4) {
            if (lvlMax >= 14) {
                ZhuFrame.getZhuJpanel().addPrompt2("已经升到最大等级");
                return;
            }
            if (chooseMaterialsGoods.getType() != 521) {
                ZhuFrame.getZhuJpanel().addPrompt2("物品不是炼星石");
                return;
            }
            num = lvlMax / 2 + 2;
            if (chooseMaterialsGoods.getUsetime() < num) {
                ZhuFrame.getZhuJpanel().addPrompt2("炼星石数量不足");
                return;
            }
            type = 55;
        }
        SuitOperBean suitOperBean = new SuitOperBean();
        suitOperBean.setType(type);
        List<BigDecimal> goods = new ArrayList<>();
        goods.add(chooseStarCardId);
        goods.add(chooseMaterialsId);
        suitOperBean.setGoods(goods);
        deductGoods(chooseMaterialsGoods, num);
        String sendmes = Agreement.suitOperateAgreement(GsonUtil.getGsonUtil().getgson().toJson(suitOperBean));
        SendMessageUntil.toServer(sendmes);
    }

    /**
     * 物品消耗扣除
     */
    public void deductGoods(Goodstable goodstable, int num) {
        goodstable.goodxh(num);
        if (goodstable.getUsetime() <= 0) {
            GoodsListFromServerUntil.Deletebiaoid(goodstable.getRgid());
            if (bigType == 1) {
                GoodsListFromServerUntil.getStarCardList().remove(goodstable);
            } else if (bigType == 2) {
                recoverMaterialsImg();
            }
        }
    }

    private ImageIcon iconBack;
    private ImageIcon iconLeft;
    private ImageIcon iconRight;
    // 名字背景
    private ImageIcon iconName;
    // 线
    private ImageIcon iconWire;

    @Override
    protected void paintComponent(Graphics g) {
        // TODO 画笔
        super.paintComponent(g);
        if ("水墨UI".equals(MyIsif.getStyle())) {
            if (iconBack == null) {
                iconBack = new ImageIcon("inkImg/newbackground/B283.png");
            }
            g.drawImage(iconBack.getImage(), 0, 0, 637, 425, this);
            g.setColor(Color.white);
            g.setFont(UIUtils.TEXT_FONT1);
            g.drawString(RoleData.getRoleData().getLoginResult().getScoretype("星芒") + "", 272 + 25, 54 - 15);

            GoodsListFromServerUntil.drawStarCardImg(g, 379 + 25 - 2, 60 - 15 + 3);

            if (bigType == 1) {
                if (iconWire == null) {
                    iconWire = CutButtonImage.getImage("inkImg/newbackground/B286.png", 190, 1);
                }
                g.drawImage(iconWire.getImage(), 28 + 25 + 160, 66 - 15 + 72, 190, 1, this);
                g.drawImage(iconWire.getImage(), 28 + 25 + 160, 66 - 15 + 126, 190, 1, this);
                g.drawImage(iconWire.getImage(), 28 + 25 + 160, 66 - 15 + 252, 190, 1, this);
                if (iconLeft == null) {
                    iconLeft = CutButtonImage.getImage("inkImg/newbackground/B284.png", 159, 114);
                }
                g.drawImage(iconLeft.getImage(), 28 + 25, 68 + 217 - 12, 159, 114, this);

                if (iconName == null) {
                    iconName = CutButtonImage.getImage("inkImg/newbackground/B287.png", 150, 30);
                }
                g.drawImage(iconName.getImage(), 28 + 25 + 160, 66 - 15, 150, 30, this);
            } else if (bigType == 2) {
                g.drawImage(iconLeft.getImage(), 40 + 25, 68 - 15 + 227, 309, 105, this);
                if (iconRight == null) {
                    iconRight = CutButtonImage.getImage("inkImg/hongmu/2/培养面板-W：288-H：198.png", 288, 198);
                }
                g.drawImage(iconRight.getImage(), 64 + 25, 72 - 15, 290, 200, this);
                g.setColor(Color.white);
                g.setFont(UIUtils.TEXT_FONT1);
                g.drawString("拥有材料:", 44 + 25, 288 - 15);
                GoodsListFromServerUntil.drawStarCardCultivateMaterialImg(g, materialType, 42 + 25, 297 - 15);
                if (smallType == 1) {
                    if (money != null) {
                        Util.drawPrice(g, money, 174 + 25, 194 - 15);
                    }
                } else if (smallType == 2) {
                    if (money != null) {
                        Util.drawPrice(g, money, 180 + 25, 191 - 15);
                    }
                    Util.drawMoney(g, 180 + 25, 191 + 26 - 15);
                } else if (smallType == 3) {
                    if (money != null) {
                        Util.drawPrice(g, money, 176 + 25, 195 - 15);
                    }
                    Util.drawMoney(g, 176 + 25, 195 + 25 - 15);
                }
            }
        } else {
            if (iconBack == null) {
                iconBack = new ImageIcon("inkImg/hongmu/2/地煞星总界面-W：611-H：447.png");
            }
            g.drawImage(iconBack.getImage(), 0, 0, 611, 447, this);
            g.setColor(Color.white);
            g.setFont(UIUtils.TEXT_FONT1);
            g.drawString(RoleData.getRoleData().getLoginResult().getScoretype("星芒") + "", 272, 54);

            GoodsListFromServerUntil.drawStarCardImg(g, 379, 60);

            if (bigType == 1) {
                if (iconWire == null) {
                    iconWire = CutButtonImage.getImage("inkImg/hongmu/2/属性-条形-W：183-H：3.png", 183, 3);
                }
                g.drawImage(iconWire.getImage(), 188, 138, 183, 3, this);
                g.drawImage(iconWire.getImage(), 188, 192, 183, 3, this);
                g.drawImage(iconWire.getImage(), 188, 318, 183, 3, this);
                if (iconLeft == null) {
                    iconLeft = CutButtonImage.getImage("inkImg/hongmu/2/战力显示框-W：162-H：115.png", 162, 115);
                }
                g.drawImage(iconLeft.getImage(), 28, 285, 162, 115, this);

                if (iconName == null) {
                    iconName = CutButtonImage.getImage("inkImg/hongmu/2/煞星名字显示-W：101-H：21.png", 101, 21);
                }
                g.drawImage(iconName.getImage(), 188, 66, 101, 21, this);
            } else if (bigType == 2) {
                g.drawImage(iconLeft.getImage(), 40, 295, 309, 105, this);
                if (iconRight == null) {
                    iconRight = CutButtonImage.getImage("inkImg/hongmu/2/培养面板-W：288-H：198.png", 288, 198);
                }
                g.drawImage(iconRight.getImage(), 64, 72, 288, 198, this);
                g.setColor(Color.white);
                g.setFont(UIUtils.TEXT_FONT1);
                g.drawString("拥有材料:", 44, 288);
                GoodsListFromServerUntil.drawStarCardCultivateMaterialImg(g, materialType, 42, 297);
                if (smallType == 1) {
                    if (money != null) {
                        Util.drawPrice(g, money, 174, 194);
                    }
                    // Util.drawMoney(g, 180 + 25, 191 + 26 - 15);
                } else if (smallType == 2) {
                    if (money != null) {
                        Util.drawPrice(g, money, 180, 217);
                    }
                    //Util.drawMoney(g, 180 + 25, 191 + 26 - 15);
                } else if (smallType == 3) {
                    if (money != null) {
                        Util.drawPrice(g, money, 176, 195);
                    }
                    //Util.drawMoney(g, 176 + 25, 195 + 25 - 15);
                }
            }
        }

    }

    public ImageIcon getIconBack() {
        return iconBack;
    }

    public void setIconBack(ImageIcon iconBack) {
        this.iconBack = iconBack;
    }

    public ImageIcon getIconLeft() {
        return iconLeft;
    }

    public void setIconLeft(ImageIcon iconLeft) {
        this.iconLeft = iconLeft;
    }

    public ImageIcon getIconRight() {
        return iconRight;
    }

    public void setIconRight(ImageIcon iconRight) {
        this.iconRight = iconRight;
    }

    public ImageIcon getIconName() {
        return iconName;
    }

    public void setIconName(ImageIcon iconName) {
        this.iconName = iconName;
    }

    public ImageIcon getIconWire() {
        return iconWire;
    }

    public void setIconWire(ImageIcon iconWire) {
        this.iconWire = iconWire;
    }

    public JLabel getCardBackImg() {
        if (cardBackImg == null) {
            cardBackImg = new JLabel();
            if ("水墨UI".equals(MyIsif.getStyle())) {
                cardBackImg.setBounds(28 + 24, 65 - 14, 160, 221);
                cardBackImg.setIcon(CutButtonImage.getImage("inkImg/newbackground/B230.png", 160, 221));
            } else {
                cardBackImg.setBounds(28, 65, 160, 221);
                cardBackImg.setIcon(CutButtonImage.getImage("inkImg/hongmu/2/地煞星显示框-W：160-H：221.png", 160, 221));
            }
            this.add(this.cardBackImg);
        }
        return cardBackImg;
    }

    public void setCardBackImg(JLabel cardBackImg) {
        this.cardBackImg = cardBackImg;
    }

    public BtnStarCard getLockBtn() {
        if (lockBtn == null) {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                lockBtn = new BtnStarCard("skin/8100226/newbutton/K156.png", 1, "", 11, this);
                lockBtn.setBounds(38 + 47 + 25, 68 + 217 - 15 + 7, 18, 18);
            } else {
                this.lockBtn = new BtnStarCard("inkImg/hongmu/2/25_png.button.btn_lock.png", 1, "", 11, this);
                this.lockBtn.setBounds(85, 292, 19, 20);
            }
            this.add(this.lockBtn);
        }
        return lockBtn;
    }

    public void setLockBtn(BtnStarCard lockBtn) {
        this.lockBtn = lockBtn;
    }

    public BtnStarCard getUnlockBtn() {
        if (unlockBtn == null) {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                unlockBtn = new BtnStarCard("skin/8100226/newbutton/K157.png", 1, "", 12, this);
                unlockBtn.setBounds(38 + 47 + 25 + 25, 68 + 217 - 15 + 7, 18, 18);
            } else {
                this.unlockBtn = new BtnStarCard("inkImg/hongmu/2/27_png.button.btn_unlock.png", 1, "", 12, this);
                this.unlockBtn.setBounds(110, 292, 19, 20);
                this.add(this.unlockBtn);
            }
        }
        return unlockBtn;
    }

    public void setUnlockBtn(BtnStarCard unlockBtn) {
        this.unlockBtn = unlockBtn;
    }

    public BtnStarCard getAttributeMenuBtn() {
        if (attributeMenuBtn == null) {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                attributeMenuBtn = new BtnStarCard("skin/8100226/button/B198.png", 1, "", 1, this);
                attributeMenuBtn.setBounds(57, 18, 63, 26);
            } else {
                this.attributeMenuBtn = new BtnStarCard("inkImg/hongmu/2/属性按钮w63,h78.png", 1, "", 1, this);
                this.attributeMenuBtn.setBounds(30, 32, 63, 26);
            }
            this.add(this.attributeMenuBtn);
        }
        return attributeMenuBtn;
    }

    public void setAttributeMenuBtn(BtnStarCard attributeMenuBtn) {
        this.attributeMenuBtn = attributeMenuBtn;
    }

    public BtnStarCard getRecastMenuBtn() {
        if (recastMenuBtn == null) {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                recastMenuBtn = new BtnStarCard("skin/8100226/button/B199.png", 1, "", 2, this);
                recastMenuBtn.setBounds(57 + 65, 18, 63, 26);
            } else {
                this.recastMenuBtn = new BtnStarCard("inkImg/hongmu/2/重铸未w63,h78px.png", 1, "", 2, this);
                this.recastMenuBtn.setBounds(95, 32, 63, 26);
            }
            this.add(this.recastMenuBtn);
        }
        return recastMenuBtn;
    }

    public void setRecastMenuBtn(BtnStarCard recastMenuBtn) {
        this.recastMenuBtn = recastMenuBtn;
    }

    public BtnStarCard getCultivateBtn() {
        if (cultivateBtn == null) {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                cultivateBtn = new BtnStarCard("skin/8100226/button/B204.png", 1, "", 3, this);
                cultivateBtn.setBounds(34 + 25, 72 - 15, 30, 48);
            } else {
                this.cultivateBtn = new BtnStarCard("inkImg/hongmu/2/培养按钮2-W：30-H：138.png", 1, "", 3, this);
                this.cultivateBtn.setBounds(34, 72, 30, 46);
            }
            this.add(this.cultivateBtn);
        }
        return cultivateBtn;
    }

    public void setCultivateBtn(BtnStarCard cultivateBtn) {
        this.cultivateBtn = cultivateBtn;
    }

    public BtnStarCard getLianStarBtn() {
        if (lianStarBtn == null) {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                lianStarBtn = new BtnStarCard("skin/8100226/button/B201.png", 1, "", 6, this);
                lianStarBtn.setBounds(34 + 25, 72 - 15 + 50 * 3, 30, 48);
            } else {
                this.lianStarBtn = new BtnStarCard("inkImg/hongmu/2/练星按钮-W：30-H：138.png", 1, "", 6, this);
                this.lianStarBtn.setBounds(34, 216, 30, 46);
            }
            this.add(this.lianStarBtn);
        }
        return lianStarBtn;
    }

    public void setLianStarBtn(BtnStarCard lianStarBtn) {
        this.lianStarBtn = lianStarBtn;
    }

    public BtnStarCard getUpgradeBtn() {
        if (upgradeBtn == null) {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                upgradeBtn = new BtnStarCard("skin/8100226/button/B205.png", 1, "", 4, this);
                upgradeBtn.setBounds(34 + 25, 72 - 15 + 50 * 1, 30, 48);
            } else {
                this.upgradeBtn = new BtnStarCard("inkImg/hongmu/2/升级按钮-W：30-H：138.png", 1, "", 4, this);
                this.upgradeBtn.setBounds(34, 120, 30, 46);
            }
            this.add(this.upgradeBtn);
        }
        return upgradeBtn;
    }

    public void setUpgradeBtn(BtnStarCard upgradeBtn) {
        this.upgradeBtn = upgradeBtn;
    }

    public BtnStarCard getRedoBtn() {
        if (redoBtn == null) {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                redoBtn = new BtnStarCard("skin/8100226/button/B207.png", 1, "", 5, this);
                redoBtn.setBounds(34 + 25, 72 - 15 + 50 * 2, 30, 48);
            } else {
                this.redoBtn = new BtnStarCard("inkImg/hongmu/2/重洗按钮-W：30-H：138.png", 1, "", 5, this);
                this.redoBtn.setBounds(34, 168, 30, 46);
            }
            this.add(this.redoBtn);
        }
        return redoBtn;
    }

    public void setRedoBtn(BtnStarCard redoBtn) {
        this.redoBtn = redoBtn;
    }

    public int getStarCardType() {
        return bigType;
    }

    public void setStarCardType(int starCardType) {
        this.bigType = starCardType;
    }

    public JLabel getCardImg() {
        if (cardImg == null) {
            cardImg = new JLabel();
            if ("水墨UI".equals(MyIsif.getStyle())) {
                cardImg.setBounds(28 + 25, 65 - 15, 160, 220);
            } else {
                cardImg.setBounds(28, 65, 160, 220);
            }
            cardImg.setOpaque(false);
            this.add(cardImg);
        }
        return cardImg;
    }

    public void setCardImg(JLabel cardImg) {
        this.cardImg = cardImg;
    }

    public JLabel getStarCardImg() {
        if (starCardImg == null) {
            starCardImg = new JLabel("地煞星", SwingConstants.CENTER);
            if ("水墨UI".equals(MyIsif.getStyle())) {
                starCardImg.setBounds(137 + 25, 98 - 15, 55, 53);
            } else {
                starCardImg.setBounds(137, 98, 55, 53);
            }
            starCardImg.setOpaque(false);
            // starCardImg.setVisible(false);
            starCardImg.setForeground(Color.gray);
            starCardImg.setFont(UIUtils.TEXT_FONT);
            starCardImg.addMouseListener(new MouseAdapter() {
                @Override
                public void mousePressed(MouseEvent e) {
                    if (e.getButton() == MouseEvent.BUTTON3) {
                        if (chooseStarCardId == null) {
                            return;
                        }
                        recoverStarCardImg();
                        viewChange(null);
                    }
                }

                @Override
                public void mouseEntered(MouseEvent e) {
                    if (chooseStarCardId == null) {
                        return;
                    }
                    Goodstable goodstable = GoodsListFromServerUntil.getRgid(chooseStarCardId);
                    if (goodstable != null) {
                        ZhuFrame.getZhuJpanel().creatgoodtext(goodstable);
                    }
                }

                @Override
                public void mouseExited(MouseEvent e) {
                    TestpackJframe.getTestpackJframe().getJpac().ClearText();
                    ZhuFrame.getZhuJpanel().cleargoodtext();
                }
            });
            this.add(starCardImg);
        }
        return starCardImg;
    }

    public void setStarCardImg(JLabel starCardImg) {
        this.starCardImg = starCardImg;
    }

    public JLabel getMaterialsImgs() {
        if (materialsImgs == null) {
            materialsImgs = new JLabel("观星册", SwingConstants.CENTER);
            if ("水墨UI".equals(MyIsif.getStyle())) {
                materialsImgs.setBounds(224 + 25, 98 - 15, 55, 53);
            } else {
                materialsImgs.setBounds(224, 98, 55, 53);
            }
            materialsImgs.setOpaque(false);
            // materialsImgs.setVisible(false);
            materialsImgs.setForeground(Color.gray);
            materialsImgs.setFont(UIUtils.TEXT_FONT);
            materialsImgs.addMouseListener(new MouseAdapter() {
                @Override
                public void mousePressed(MouseEvent e) {
                    if (e.getButton() == MouseEvent.BUTTON3) {
                        if (chooseMaterialsId == null) {
                            return;
                        }
                        recoverMaterialsImg();
                        viewChange(null);
                    }
                }

                @Override
                public void mouseEntered(MouseEvent e) {
                    if (chooseMaterialsId == null) {
                        return;
                    }
                    Goodstable goodstable = GoodsListFromServerUntil.getRgid(chooseMaterialsId);
                    if (goodstable != null) {
                        ZhuFrame.getZhuJpanel().creatgoodtext(goodstable);
                    }
                }

                @Override
                public void mouseExited(MouseEvent e) {
                    TestpackJframe.getTestpackJframe().getJpac().ClearText();
                    ZhuFrame.getZhuJpanel().cleargoodtext();
                }
            });
            this.add(materialsImgs);
        }
        return materialsImgs;
    }

    public void setMaterialsImgs(JLabel materialsImgs) {
        this.materialsImgs = materialsImgs;
    }

    public JLabel getRadioOneImg() {
        if (radioOneImg == null) {
            radioOneImg = new JLabel("", SwingConstants.CENTER);
            if ("水墨UI".equals(MyIsif.getStyle())) {
                radioOneImg.setBounds(107 + 25 + 1, 78 - 15 + 1, 19, 19);
                // radioOneImg.setOpaque(false);
                radioOneImg.setVisible(false);
                radioOneImg.setIcon(CutButtonImage.getImage("skin/8100226/button/B118.png", 7, 7));
            } else {
                radioOneImg.setBounds(107, 78, 19, 19);
                // radioOneImg.setOpaque(false);
                radioOneImg.setVisible(false);
                radioOneImg.setIcon(CutButtonImage.getImage("inkImg/hongmu/2/单选按钮_选中_w19,h19.png", 19, 19));
            }
            radioOneImg.addMouseListener(new MouseAdapter() {
                @Override
                public void mousePressed(MouseEvent e) {
                    changeRadioView(1);
                }
            });
            this.add(radioOneImg);
        }
        return radioOneImg;
    }

    public void setRadioOneImg(JLabel radioOneImg) {
        this.radioOneImg = radioOneImg;
    }

    public JLabel getRadioTwoImg() {
        if (radioTwoImg == null) {
            radioTwoImg = new JLabel();
            if ("水墨UI".equals(MyIsif.getStyle())) {
                radioTwoImg.setBounds(215 + 25 + 6, 78 - 15 + 1, 19, 19);
                radioTwoImg.setVisible(false);
                this.radioTwoImg.setIcon(CutButtonImage.getImage("skin/8100226/button/B118.png", 7, 7));
            } else {
                radioTwoImg.setBounds(215, 78, 19, 19);
                // radioTwoImg.setOpaque(false);
                radioTwoImg.setVisible(false);
                this.radioTwoImg.setIcon(CutButtonImage.getImage("inkImg/hongmu/2/单选按钮_未选中_w19,h19.png", 19, 19));
            }
            radioTwoImg.addMouseListener(new MouseAdapter() {
                @Override
                public void mousePressed(MouseEvent e) {
                    changeRadioView(2);
                }
            });
            this.add(radioTwoImg);
        }
        return radioTwoImg;
    }

    public void setRadioTwoImg(JLabel radioTwoImg) {
        this.radioTwoImg = radioTwoImg;
    }

    public JLabel getConsumeOneLab() {
        if (consumeOneLab == null) {
            consumeOneLab = new JLabel();
            consumeOneLab.setBounds(173, 181, 108, 16);
            consumeOneLab.setForeground(Color.white);
            consumeOneLab.setFont(UIUtils.TEXT_FONT);
            consumeOneLab.setOpaque(false);
            consumeOneLab.setVisible(false);
            this.add(consumeOneLab);
        }
        return consumeOneLab;
    }

    public void setConsumeOneLab(JLabel consumeOneLab) {
        this.consumeOneLab = consumeOneLab;
    }

    public JLabel getConsumeTwoLab() {
        if (consumeTwoLab == null) {
            consumeTwoLab = new JLabel();
            consumeTwoLab.setBounds(173, 181 + 21, 108, 16);
            consumeTwoLab.setForeground(Color.white);
            consumeTwoLab.setFont(UIUtils.TEXT_FONT);
            consumeTwoLab.setOpaque(false);
            consumeTwoLab.setVisible(false);
            this.add(consumeTwoLab);
        }
        return consumeTwoLab;
    }

    public void setConsumeTwoLab(JLabel consumeTwoLab) {
        this.consumeTwoLab = consumeTwoLab;
    }

    public int getBigType() {
        return bigType;
    }

    public void setBigType(int bigType) {
        this.bigType = bigType;
    }

    public int getSmallType() {
        return smallType;
    }

    public void setSmallType(int smallType) {
        this.smallType = smallType;
    }

    public JLabel[] getMaterialsLab() {
        if (materialsLab == null) {
            materialsLab = new JLabel[12];
            if ("水墨UI".equals(MyIsif.getStyle())) {
                for (int i = 0; i < materialsLab.length; i++) {
                    materialsLab[i] = new JLabel();
                    materialsLab[i].setBounds(42 + 25 + i % 6 * 51, 297 - 15 + i / 6 * 51, 50, 50);
                    materialsLab[i].setOpaque(false);
                    materialsLab[i].addMouseListener(new MouseListenerMaterials(i, this));
                    this.add(materialsLab[i]);
                }
            } else {
                for (int i = 0; i < materialsLab.length; i++) {
                    materialsLab[i] = new JLabel();
                    materialsLab[i].setBounds(42 + i % 6 * 51, 297 + i / 6 * 51, 50, 50);
                    materialsLab[i].setOpaque(false);
                    materialsLab[i].addMouseListener(new MouseListenerMaterials(i, this));
                    this.add(materialsLab[i]);
                }
            }

        }
        return materialsLab;
    }

    public void setMaterialsLab(JLabel[] materialsLab) {
        this.materialsLab = materialsLab;
    }

    public int getRadioType() {
        return radioType;
    }

    public void setRadioType(int radioType) {
        this.radioType = radioType;
    }

    public BigDecimal getChooseStarCardId() {
        return chooseStarCardId;
    }

    public void setChooseStarCardId(BigDecimal chooseStarCardId) {
        this.chooseStarCardId = chooseStarCardId;
    }

    public BigDecimal getChooseMaterialsId() {
        return chooseMaterialsId;
    }

    public void setChooseMaterialsId(BigDecimal chooseMaterialsId) {
        this.chooseMaterialsId = chooseMaterialsId;
    }

    public BigDecimal getMoney() {
        return money;
    }

    public void setMoney(BigDecimal money) {
        this.money = money;
    }

    public JLabel[] getStarCardLab() {
        if (starCardLab == null) {
            starCardLab = new JLabel[24];
            if ("水墨UI".equals(MyIsif.getStyle())) {
                for (int i = 0; i < starCardLab.length; i++) {
                    starCardLab[i] = new JLabel();
                    starCardLab[i].setBounds(379 + 25 - 2 + i % 4 * 51, 60 - 15 + 3 + i / 4 * 51, 50, 50);
                    starCardLab[i].setOpaque(false);
                    starCardLab[i].addMouseListener(new MouseListenerStarCardMain(i, this));
                    this.add(starCardLab[i]);
                }
            } else {
                for (int i = 0; i < starCardLab.length; i++) {
                    starCardLab[i] = new JLabel();
                    starCardLab[i].setBounds(379 + i % 4 * 51, 60 + i / 4 * 51, 50, 50);
                    starCardLab[i].setOpaque(false);
                    starCardLab[i].addMouseListener(new MouseListenerStarCardMain(i, this));
                    this.add(starCardLab[i]);
                }
            }

        }
        return starCardLab;
    }

    public void setStarCardLab(JLabel[] starCardLab) {
        this.starCardLab = starCardLab;
    }

    public BtnStarCard getCaozuoBtn() {
        if (caozuoBtn == null) {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                caozuoBtn = new BtnStarCard("skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "", 20,
                        this);
                caozuoBtn.setBounds(180 + 25, 240 - 15, 59, 24);
            } else {
                caozuoBtn = new BtnStarCard("inkImg/hongmu/1/6026.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_HY88, "", 20,
                        this);
                caozuoBtn.setBounds(180, 240, 60, 26);
            }

            caozuoBtn.setVisible(false);
            this.add(caozuoBtn);
        }
        return caozuoBtn;
    }

    public void setCaozuoBtn(BtnStarCard caozuoBtn) {
        this.caozuoBtn = caozuoBtn;
    }

    public BtnStarCard getJoinBtn() {
        if (joinBtn == null) {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                joinBtn = new BtnStarCard("skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "参战", 21,
                        this);
                joinBtn.setBounds(82 + 25, 370 - 15, 59, 24);
            } else {
                joinBtn = new BtnStarCard("inkImg/hongmu/1/6026.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_HY88, "参战", 21,
                        this);
                joinBtn.setBounds(82, 370, 60, 26);
            }

            this.add(joinBtn);
        }
        return joinBtn;
    }

    public void setJoinBtn(BtnStarCard joinBtn) {
        this.joinBtn = joinBtn;
    }

    public BtnStarCard getFetchBtn() {
        if (fetchBtn == null) {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                fetchBtn = new BtnStarCard("skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "取出",
                        22, this);
                fetchBtn.setBounds(400 + 25, 380 - 15, 59, 24);
            } else {
                fetchBtn = new BtnStarCard("inkImg/hongmu/1/6026.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_HY16, "取出",
                        22, this);
                fetchBtn.setBounds(395, 372, 60, 26);
            }

            this.add(fetchBtn);
        }
        return fetchBtn;
    }

    public void setFetchBtn(BtnStarCard fetchBtn) {
        this.fetchBtn = fetchBtn;
    }

    public BtnStarCard getSoulBackBtn() {
        if (soulBackBtn == null) {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                soulBackBtn = new BtnStarCard("skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "魂归",
                        23, this);
                soulBackBtn.setBounds(500 + 25, 380 - 15, 59, 24);
            } else {
                soulBackBtn = new BtnStarCard("inkImg/hongmu/1/6026.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_HY16, "魂归",
                        23, this);
                soulBackBtn.setBounds(495, 372, 60, 26);
            }

            this.add(soulBackBtn);
        }
        return soulBackBtn;
    }

    public void setSoulBackBtn(BtnStarCard soulBackBtn) {
        this.soulBackBtn = soulBackBtn;
    }

    public BtnStarCard getExchangeBtn() {
        if (exchangeBtn == null) {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                exchangeBtn = new BtnStarCard("skin/8100226/button/2.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT, "兑换", 24,
                        this);
                exchangeBtn.setBounds(340 + 25 - 2, 40 - 15 + 1, 34, 17);
            } else {
                exchangeBtn = new BtnStarCard("inkImg/hongmu/1/B30h.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_FONT, "兑换", 24, this);
                exchangeBtn.setBounds(340, 40, 34, 17);
            }

            this.add(exchangeBtn);
        }
        return exchangeBtn;
    }

    public void setExchangeBtn(BtnStarCard exchangeBtn) {
        this.exchangeBtn = exchangeBtn;
    }

    public BtnStarCard getSupplementBtn() {
        if (supplementBtn == null) {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                supplementBtn = new BtnStarCard("skin/8100226/button/2.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT, "补充",
                        25, this);
                supplementBtn.setBounds(143 + 25 + 1, 345 - 15 + 1, 34, 17);
            } else {
                supplementBtn = new BtnStarCard("inkImg/hongmu/1/B30h.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_FONT, "补充",
                        25, this);
                supplementBtn.setBounds(143, 345, 34, 17);
            }

            this.add(supplementBtn);
        }
        return supplementBtn;
    }

    public void setSupplementBtn(BtnStarCard supplementBtn) {
        this.supplementBtn = supplementBtn;
    }

    public RichLabel getNameLvlLab() {
        if (nameLvlLab == null) {
            nameLvlLab = new RichLabel("#cD3D001  星卡名称#r #r#W【等级】 8 / 14", UIUtils.TEXT_NAME_FONT);
            if ("水墨UI".equals(MyIsif.getStyle())) {
                nameLvlLab.setBounds(188 + 25, 64 - 15, 180, 66);
            } else {
                nameLvlLab.setBounds(188, 64, 180, 66);
            }

            this.add(nameLvlLab);
        }
        return nameLvlLab;
    }

    public void setNameLvlLab(RichLabel nameLvlLab) {
        this.nameLvlLab = nameLvlLab;
    }

    public RichLabel getPowerLab() {
        if (powerLab == null) {
            powerLab = new RichLabel("#W【神通】 资质：100/100#r#G雷系狂暴程度 +11.2%#r雷系狂暴程度 +12.0%", UIUtils.TEXT_FONT2);
            if ("水墨UI".equals(MyIsif.getStyle())) {
                powerLab.setBounds(190 + 25, 142 - 15, 180, 80);
            } else {
                powerLab.setBounds(190, 142, 180, 80);
            }

            this.add(powerLab);
        }
        return powerLab;
    }

    public void setPowerLab(RichLabel powerLab) {
        this.powerLab = powerLab;
    }

    public RichLabel getFiveElementsLab() {
        if (fiveElementsLab == null) {
            fiveElementsLab = new RichLabel(
                    "#W【五行】#r#Y金 51/100#r#Y木 66/100#r#Y水 41/100#r#Y火 23/100#r土 99/100#r#Y无星阵，五行暂不生效",
                    UIUtils.TEXT_FONT2);
            if ("水墨UI".equals(MyIsif.getStyle())) {
                fiveElementsLab.setBounds(190 + 25, 193 - 15, 180, 116);
            } else {
                fiveElementsLab.setBounds(190, 193, 180, 116);
            }

            this.add(fiveElementsLab);
        }
        return fiveElementsLab;
    }

    public void setFiveElementsLab(RichLabel fiveElementsLab) {
        this.fiveElementsLab = fiveElementsLab;
    }

    public RichLabel getStarArrayLab() {
        if (StarArrayLab == null) {
            StarArrayLab = new RichLabel("#W【星阵之力】 朱雀 ", UIUtils.TEXT_FONT2);
            if ("水墨UI".equals(MyIsif.getStyle())) {
                StarArrayLab.setBounds(190 + 25, 320 - 15, 180, 20);
            } else {
                StarArrayLab.setBounds(190, 320, 180, 20);
            }

            this.add(StarArrayLab);
        }
        return StarArrayLab;
    }

    public void setStarArrayLab(RichLabel starArrayLab) {
        StarArrayLab = starArrayLab;
    }

    public long getMaterialType() {
        return materialType;
    }

    public void setMaterialType(long materialType) {
        this.materialType = materialType;
    }

    public JLabel getStarArrayBackImg() {
        if (starArrayBackImg == null) {
            starArrayBackImg = new JLabel();
            if ("水墨UI".equals(MyIsif.getStyle())) {
                starArrayBackImg.setIcon(CutButtonImage.getImage("inkImg/old/background/S116.png", 51, 51));
                starArrayBackImg.setBounds(225 + 25, 343 - 15, 51, 51);
            } else {
                starArrayBackImg.setIcon(CutButtonImage.getImage("inkImg/hongmu/2/方框w51,h51px.png", 51, 51));
                starArrayBackImg.setBounds(225, 343, 51, 51);
            }

            this.add(starArrayBackImg);
        }
        return starArrayBackImg;
    }

    public void setStarArrayBackImg(JLabel starArrayBackImg) {
        this.starArrayBackImg = starArrayBackImg;
    }

    public JLabel getStarArryImg() {
        if (starArryImg == null) {
            starArryImg = new JLabel();
            if ("水墨UI".equals(MyIsif.getStyle())) {
                starArryImg.setBounds(227 + 25, 345 - 15, 47, 47);
            } else {
                starArryImg.setBounds(227, 345, 47, 47);
            }

            starArryImg.setOpaque(false);
            this.add(starArryImg);
        }
        return starArryImg;
    }

    public void setStarArryImg(JLabel starArryImg) {
        this.starArryImg = starArryImg;
    }

    public BtnStarCard getDeleteBtn() {
        if (deleteBtn == null) {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                deleteBtn = new BtnStarCard("skin/8100226/button/2.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT, "删除", 26,
                        this);
                deleteBtn.setBounds(280 + 25, 345 - 15, 34, 17);
            } else {
                deleteBtn = new BtnStarCard("inkImg/hongmu/21_png.button.tab_nex.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_FONT, "删除", 26,
                        this);
                deleteBtn.setBounds(280, 345, 34, 17);
            }

            this.add(deleteBtn);
        }
        return deleteBtn;
    }

    public void setDeleteBtn(BtnStarCard deleteBtn) {
        this.deleteBtn = deleteBtn;
    }

    public BtnStarCard getTransferBtn() {
        if (transferBtn == null) {
            if ("水墨UI".equals(MyIsif.getStyle())) {
                transferBtn = new BtnStarCard("skin/8100226/button/2.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT, "转移", 27,
                        this);
                transferBtn.setBounds(280 + 25, 365 - 15, 34, 17);

            } else {
                transferBtn = new BtnStarCard("inkImg/hongmu/21_png.button.tab_nex.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_FONT, "转移", 27,
                        this);
                transferBtn.setBounds(280, 365, 34, 17);
            }
            this.add(transferBtn);
        }
        return transferBtn;
    }

    public void setTransferBtn(BtnStarCard transferBtn) {
        this.transferBtn = transferBtn;
    }

}
